<template>
  <div id="app">
  <!-- Vue中的路由只能在组件与组件之间进行跳转   -->
    <nav>
      <!-- 声明式路由跳转 -->
      <router-link to="/">Home</router-link> |
      <router-link to="/about">About</router-link> |
      <router-link to="/info">Info</router-link> |
      <router-link to="/xinwen?age=18">xinwen1</router-link> |
      <router-link :to="{path:'/xinwen?name=吴彦祖'}">xinwen2</router-link> |
      <router-link :to="{name:'liudehua',params:{name:'周星驰'}}">xinwen3</router-link> |
    </nav>
    <router-view/>
  </div>
</template>
<script>
export default {
  watch:{
    $route(to,from){
      console.log("to",to)
      // console.log("from",from)
    }
  }
}
</script>
<style lang="scss">
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}

nav {
  padding: 30px;

  a {
    font-weight: bold;
    color: #2c3e50;

    &.router-link-exact-active {
      color: #42b983;
    }
  }
}
</style>
